﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_NguoiDung : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("AdvNhanVien")]
        private ADVObjects _AdvNhanVien;
        [AccessedThroughProperty("CboGroup")]
        private ComboBox _CboGroup;
        [AccessedThroughProperty("CKKhoiPhucQuyenNhom")]
        private CheckBox _CKKhoiPhucQuyenNhom;
        [AccessedThroughProperty("CKXemThongTinCaNhan")]
        private CheckBox _CKXemThongTinCaNhan;
        [AccessedThroughProperty("CmdChon")]
        private Button _CmdChon;
        [AccessedThroughProperty("CmdThoat")]
        private Button _CmdThoat;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("Label4")]
        private Label _Label4;
        [AccessedThroughProperty("Label5")]
        private Label _Label5;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("TxtPassword")]
        private TextBox _TxtPassword;
        [AccessedThroughProperty("TxtUsername")]
        private TextBox _TxtUsername;
        [AccessedThroughProperty("TxtXacNhan")]
        private TextBox _TxtXacNhan;
        public string cFrmKhoa;
        public string cFrmTask;
        private IContainer components;
        public string CrmKhoa;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsNguoiDung objNND;

        public Frm_NguoiDung()
        {
            base.KeyDown += new KeyEventHandler(this.Frm_NguoiDung_KeyDown);
            base.Load += new EventHandler(this.Frm_NguoiDung_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objNND = new clsNguoiDung();
            this.cFrmKhoa = "";
            this.cFrmTask = "";
            this.InitializeComponent();
        }

        private void CboGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.CKKhoiPhucQuyenNhom.Checked = true;
        }

        public bool checkIvalid()
        {
            if (this.AdvNhanVien.Value == "")
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải chọn nh\x00e2n vi\x00ean", ""));
                this.AdvNhanVien.Focus();
                return false;
            }
            if (this.TxtUsername.Text.Trim() == "")
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải nhập t\x00ean đăng nhập", ""));
                this.TxtUsername.Focus();
                return false;
            }
            if (this.cFrmTask != "U")
            {
                if (this.objNND.CheckExistsUsername(this.TxtUsername.Text.Trim()))
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("T\x00ean đăng nhập n\x00e0y đ\x00e3 tồn tại", ""));
                    this.TxtUsername.Focus();
                    return false;
                }
                if (this.TxtPassword.Text.Trim() == "")
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải nhập mật khẩu", ""));
                    this.TxtPassword.Focus();
                    return false;
                }
                if (this.TxtXacNhan.Text.Trim() == "")
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải x\x00e1c nhận mật khẩu", ""));
                    this.TxtXacNhan.Focus();
                    return false;
                }
                if (this.TxtXacNhan.Text.Trim() != this.TxtPassword.Text.Trim())
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("X\x00e1c nhận mật khẩu chưa ch\x00ednh x\x00e1c", ""));
                    this.TxtXacNhan.Focus();
                    return false;
                }
            }
            return true;
        }

        private void CmdChon_Click(object sender, EventArgs e)
        {
            if (this.checkIvalid())
            {
                clsNguoiDung objNND = this.objNND;
                objNND.KhoaNhanVien = this.AdvNhanVien.Value;
                objNND.TenDangNhap = this.TxtUsername.Text;
                objNND.MatKhau = this.TxtPassword.Text;
                objNND.KhoaNhom = Conversions.ToString(this.CboGroup.SelectedValue);
                if (this.CKXemThongTinCaNhan.Checked)
                {
                    objNND.GioiHanDuLieu = 1;
                }
                else
                {
                    objNND.GioiHanDuLieu = 0;
                }
                int khoiPhucQuyenNhom = 1;
                if (this.CKKhoiPhucQuyenNhom.Checked)
                {
                    khoiPhucQuyenNhom = 1;
                }
                else
                {
                    khoiPhucQuyenNhom = 0;
                }
                objNND.Save(khoiPhucQuyenNhom, this.cFrmTask);
                objNND = null;
                this.Dispose();
            }
        }

        private void CmdThoat_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_NguoiDung_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F1)
            {
                LVYModule.ShowHelp(@"HETHONG\QUANLYNGUOIDUNG.mht");
            }
        }

        private void Frm_NguoiDung_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.CmdChon.Enabled = this.mAllowEdit;
                this.objNND.LoadDL(this.CrmKhoa);
                BuildComboModule.BuildCombo(this.CboGroup, modGeneral.ListDanhMuc.NhomNguoiDung, false, "", "");
                if (LVYModule.ReturnIfNull(this.cFrmKhoa, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
                {
                    this.ShowData(this.cFrmKhoa);
                }
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_NguoiDung));
            this.CboGroup = new ComboBox();
            this.Label4 = new Label();
            this.TxtPassword = new TextBox();
            this.Label3 = new Label();
            this.TxtUsername = new TextBox();
            this.Label2 = new Label();
            this.Label1 = new Label();
            this.TxtXacNhan = new TextBox();
            this.Label5 = new Label();
            this.AdvNhanVien = new ADVObjects();
            this.CmdThoat = new Button();
            this.CmdChon = new Button();
            this.GroupBox1 = new GroupBox();
            this.CKKhoiPhucQuyenNhom = new CheckBox();
            this.CKXemThongTinCaNhan = new CheckBox();
            this.Panel1 = new Panel();
            this.GroupBox1.SuspendLayout();
            this.Panel1.SuspendLayout();
            this.SuspendLayout();
            this.CboGroup.FormattingEnabled = true;
            Point point = new Point(0x73, 0x39);
            this.CboGroup.Location = point;
            this.CboGroup.Name = "CboGroup";
            Size size = new Size(0x9f, 0x15);
            this.CboGroup.Size = size;
            this.CboGroup.TabIndex = 3;
            this.Label4.AutoSize = true;
            point = new Point(0x1a, 0x3b);
            this.Label4.Location = point;
            this.Label4.Name = "Label4";
            size = new Size(0x23, 13);
            this.Label4.Size = size;
            this.Label4.TabIndex = 2;
            this.Label4.Text = "Nh\x00f3m";
            point = new Point(0x73, 110);
            this.TxtPassword.Location = point;
            this.TxtPassword.Name = "TxtPassword";
            this.TxtPassword.PasswordChar = '*';
            size = new Size(0x131, 20);
            this.TxtPassword.Size = size;
            this.TxtPassword.TabIndex = 7;
            this.Label3.AutoSize = true;
            point = new Point(0x1a, 0x70);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x34, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 6;
            this.Label3.Text = "Mật khẩu";
            point = new Point(0x73, 0x54);
            this.TxtUsername.Location = point;
            this.TxtUsername.Name = "TxtUsername";
            size = new Size(0x131, 20);
            this.TxtUsername.Size = size;
            this.TxtUsername.TabIndex = 5;
            this.Label2.AutoSize = true;
            point = new Point(0x1a, 0x55);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x51, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 4;
            this.Label2.Text = "T\x00ean đăng nhập";
            this.Label1.AutoSize = true;
            point = new Point(0x1a, 0x20);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x38, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0;
            this.Label1.Text = "Nh\x00e2n vi\x00ean";
            point = new Point(0x73, 0x88);
            this.TxtXacNhan.Location = point;
            this.TxtXacNhan.Name = "TxtXacNhan";
            this.TxtXacNhan.PasswordChar = '*';
            size = new Size(0x131, 20);
            this.TxtXacNhan.Size = size;
            this.TxtXacNhan.TabIndex = 9;
            this.Label5.AutoSize = true;
            point = new Point(0x1a, 0x8a);
            this.Label5.Location = point;
            this.Label5.Name = "Label5";
            size = new Size(0x35, 13);
            this.Label5.Size = size;
            this.Label5.TabIndex = 8;
            this.Label5.Text = "X\x00e1c nhận";
            this.AdvNhanVien.Conditions = "";
            this.AdvNhanVien.LoaiDoiTuong = modGeneral.TypeObjects.NhanVien;
            point = new Point(0x73, 0x1d);
            this.AdvNhanVien.Location = point;
            this.AdvNhanVien.Name = "AdvNhanVien";
            this.AdvNhanVien.ReadOnly = false;
            size = new Size(0x131, 20);
            this.AdvNhanVien.Size = size;
            this.AdvNhanVien.TabIndex = 1;
            this.AdvNhanVien.UpperText = true;
            this.AdvNhanVien.Value = "";
            this.AdvNhanVien.WidthCode = 80;
            this.CmdThoat.DialogResult = DialogResult.Cancel;
            this.CmdThoat.Image = (Image) manager.GetObject("CmdThoat.Image");
            this.CmdThoat.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x16c, 4);
            this.CmdThoat.Location = point;
            this.CmdThoat.Name = "CmdThoat";
            size = new Size(0x4f, 0x18);
            this.CmdThoat.Size = size;
            this.CmdThoat.TabIndex = 1;
            this.CmdThoat.Text = "&Tho\x00e1t";
            this.CmdThoat.UseVisualStyleBackColor = true;
            this.CmdChon.Image = (Image) manager.GetObject("CmdChon.Image");
            this.CmdChon.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x119, 4);
            this.CmdChon.Location = point;
            this.CmdChon.Name = "CmdChon";
            size = new Size(0x4e, 0x18);
            this.CmdChon.Size = size;
            this.CmdChon.TabIndex = 0;
            this.CmdChon.Text = "&Chọn";
            this.CmdChon.UseVisualStyleBackColor = true;
            this.GroupBox1.BackColor = Color.Transparent;
            this.GroupBox1.Controls.Add(this.CKKhoiPhucQuyenNhom);
            this.GroupBox1.Controls.Add(this.CKXemThongTinCaNhan);
            this.GroupBox1.Controls.Add(this.AdvNhanVien);
            this.GroupBox1.Controls.Add(this.Label1);
            this.GroupBox1.Controls.Add(this.Label2);
            this.GroupBox1.Controls.Add(this.TxtUsername);
            this.GroupBox1.Controls.Add(this.TxtXacNhan);
            this.GroupBox1.Controls.Add(this.Label3);
            this.GroupBox1.Controls.Add(this.Label5);
            this.GroupBox1.Controls.Add(this.TxtPassword);
            this.GroupBox1.Controls.Add(this.CboGroup);
            this.GroupBox1.Controls.Add(this.Label4);
            this.GroupBox1.Dock = DockStyle.Fill;
            point = new Point(0, 0);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            size = new Size(0x1be, 0xf3);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 0;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "Th\x00f4ng tin người d\x00f9ng";
            this.CKKhoiPhucQuyenNhom.AutoSize = true;
            point = new Point(280, 0x3b);
            this.CKKhoiPhucQuyenNhom.Location = point;
            this.CKKhoiPhucQuyenNhom.Name = "CKKhoiPhucQuyenNhom";
            size = new Size(0x87, 0x11);
            this.CKKhoiPhucQuyenNhom.Size = size;
            this.CKKhoiPhucQuyenNhom.TabIndex = 11;
            this.CKKhoiPhucQuyenNhom.Text = "Kh\x00f4i phục quyền nh\x00f3m";
            this.CKKhoiPhucQuyenNhom.UseVisualStyleBackColor = true;
            this.CKXemThongTinCaNhan.AutoSize = true;
            point = new Point(0x73, 160);
            this.CKXemThongTinCaNhan.Location = point;
            this.CKXemThongTinCaNhan.Name = "CKXemThongTinCaNhan";
            size = new Size(0x63, 0x11);
            this.CKXemThongTinCaNhan.Size = size;
            this.CKXemThongTinCaNhan.TabIndex = 10;
            this.CKXemThongTinCaNhan.Text = "Giới hạn dữ liệu";
            this.CKXemThongTinCaNhan.UseVisualStyleBackColor = true;
            this.Panel1.BackColor = Color.Transparent;
            this.Panel1.Controls.Add(this.CmdChon);
            this.Panel1.Controls.Add(this.CmdThoat);
            this.Panel1.Dock = DockStyle.Bottom;
            point = new Point(0, 0xd3);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x1be, 0x20);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 1;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x1be, 0xf3);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.Panel1);
            this.Controls.Add(this.GroupBox1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.KeyPreview = true;
            this.Name = "Frm_NguoiDung";
            this.RightToLeft = RightToLeft.No;
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "HT-0002";
            this.Text = "NGUOI SU DUNG";
            this.GroupBox1.ResumeLayout(false);
            this.GroupBox1.PerformLayout();
            this.Panel1.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        public void ShowData(string pKhoa)
        {
            if (LVYModule.ReturnIfNull(pKhoa, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                clsNguoiDung objNND = this.objNND;
                if (objNND.LoadDL(pKhoa))
                {
                    this.cFrmKhoa = objNND.KhoaDonVi;
                    this.AdvNhanVien.Value = objNND.KhoaNhanVien;
                    this.CboGroup.SelectedValue = objNND.KhoaNhom.Trim();
                    this.CKKhoiPhucQuyenNhom.Checked = false;
                    this.TxtUsername.Text = objNND.TenDangNhap.Trim();
                    this.TxtPassword.Text = "";
                    if (objNND.GioiHanDuLieu == 1)
                    {
                        this.CKXemThongTinCaNhan.Checked = true;
                    }
                    else
                    {
                        this.CKXemThongTinCaNhan.Checked = false;
                    }
                    objNND = null;
                }
            }
        }

        internal virtual ADVObjects AdvNhanVien
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvNhanVien;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvNhanVien = value;
            }
        }

        internal virtual ComboBox CboGroup
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboGroup;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboGroup_SelectedIndexChanged);
                if (this._CboGroup != null)
                {
                    this._CboGroup.SelectedIndexChanged -= handler;
                }
                this._CboGroup = value;
                if (this._CboGroup != null)
                {
                    this._CboGroup.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual CheckBox CKKhoiPhucQuyenNhom
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CKKhoiPhucQuyenNhom;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CKKhoiPhucQuyenNhom = value;
            }
        }

        internal virtual CheckBox CKXemThongTinCaNhan
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CKXemThongTinCaNhan;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CKXemThongTinCaNhan = value;
            }
        }

        internal virtual Button CmdChon
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdChon;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdChon_Click);
                if (this._CmdChon != null)
                {
                    this._CmdChon.Click -= handler;
                }
                this._CmdChon = value;
                if (this._CmdChon != null)
                {
                    this._CmdChon.Click += handler;
                }
            }
        }

        internal virtual Button CmdThoat
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdThoat;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdThoat_Click);
                if (this._CmdThoat != null)
                {
                    this._CmdThoat.Click -= handler;
                }
                this._CmdThoat = value;
                if (this._CmdThoat != null)
                {
                    this._CmdThoat.Click += handler;
                }
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Label Label4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label4 = value;
            }
        }

        internal virtual Label Label5
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label5;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label5 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual TextBox TxtPassword
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtPassword;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtPassword = value;
            }
        }

        internal virtual TextBox TxtUsername
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtUsername;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtUsername = value;
            }
        }

        internal virtual TextBox TxtXacNhan
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtXacNhan;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtXacNhan = value;
            }
        }
    }
}

